package list.arraylist;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        ArrayList<String> strs = new ArrayList<>();
        strs.add("11");
        strs.add("12");
        strs.add("13");
        @SuppressWarnings("unchecked")
        ArrayList<String> clone = (ArrayList<String>) strs.clone();
        strs.remove(0);
        clone.forEach(System.out::println);
        System.out.println("---------");
        strs.forEach(System.out::println);
        System.out.println("----------");
        Object[] array = clone.toArray();
        for (Object object : array) {
            System.out.println(object);
        }
        System.out.println("-----------");
        String[] strArr = new String[clone.size()-2];
        strArr = clone.toArray(strArr);
        for (Object object : strArr) {
            System.out.println(object);
        }
    }
}
